<%@ page language="java" import="java.util.*" pageEncoding="UTF-8"%>
<%@include file="/WEB-INF/mytag.jspf"%>

<!DOCTYPE html>
<html>
<head>
<base href="<%=basePath%>">
<title>商品库存管理</title>
<script type="text/javascript">
$(function() {
	$("form").validate({
		rules : {
			"num" : {
				required : true,
				positiveinteger :true
			},
			"shopName" : {
				required : true
			}
		},
		messages : {
			"num" : {
				required : "请输入库存数量",
				positiveinteger : "数量请输入大于0的正整数"
			},
			"shopName" : {
				required : "请选择门店"
			}
		},
		errorPlacement: function(error, element){//错误信息显示位置
			if(element.attr("name")=="shopName"){
				error.css("left",$(element).width()+110);
				error.insertAfter(element);
			}else{
				error.insertAfter(element);
			}
		 }
	});
});
var layerPage;//弹出框关闭时用到
function showShopTree() {
	layerPage = layer.open({
		title : "选择未添加库存的门店",
		type : 2,
		content : 'management/mdse/store/noStoreShopTree/${t.mdseId}'
	});
}
function showTreeData(treeNode){
	$("#shopName").val(treeNode.name);
	$("#shopId").val(treeNode.id);
}
</script>
</head>
<body>
	<ol class="am-breadcrumb am-breadcrumb-slash am-padding" style="margin-bottom: 0px;">
		<li><a href="management/index">首页</a></li>
		<li><a href="management/mdse/index">商品管理</a></li>
		<li><a href="management/mdse/store/index/${t.mdseId}">商品库存管理</a></li>
		<li class="am-active">新增</li>
	</ol>
	<div class="am-g">
		<div class="am-u-md-12">
			<form class="am-form am-form-horizontal" id="form" name="form"  method="post" action="management/mdse/store/save">
			<div class="am-tabs am-margin">
					<ul class="am-tabs-nav am-nav am-nav-tabs">
						<li class="am-active"><a href="javascript:void(0)">基本信息</a></li>
					</ul>
					<div class="am-tabs-bd">
						<div class="am-tab-panel am-active">
							<div class="am-form-group">
								<label class="am-u-md-2 am-text-right am-form-label">商品名称</label>
								<div class="am-u-md-4 am-u-end">
									<input type="text" id="mdseName" name="mdseName" value="${t.name}" class="am-form-field am-input-sm" readonly>
									<input id="mdseId" name="mdseId" type="hidden" value="${t.mdseId }">
								</div>
							</div>
							<div class="am-form-group">
								<label class="am-u-md-2 am-text-right am-form-label">所属门店</label>
								<div class="am-u-md-4 am-u-end">
									<input type="text" placeholder="请选择未添加库存的门店" id="shopName" name="shopName" class="am-form-field am-input-sm" readonly onclick="showShopTree();">
									<input type="hidden" id="shopId" name="shopId" class="am-form-field am-input-sm">
								</div>
								<label class="am-u-sm-1 am-form-label am-u-end am-text-left">
									<a href="javascript:void(0);" onclick="showShopTree(); return false;">选择</a>
								</label>
							</div>
							<div class="am-form-group">
								<label class="am-u-md-2 am-text-right am-form-label">库存数量</label>
								<div class="am-u-md-4 am-u-end">
									<input type="number" id="num" name="num" class="am-form-field am-input-sm" maxlength="10">
								</div>
							</div>
						</div>
					</div>
				</div>
				<div class="am-margin">
					<button class="am-btn am-btn-primary am-btn-xs" type="submit"><span class="am-icon-check"></span> 保存</button>
					<a href="javascript:;" onClick="javascript:history.back(-1);" class="am-btn am-btn-primary am-btn-xs"><span class="am-icon-times"></span> 取消</a>
				</div>
			</form>
		</div>
	</div>
</body>
</html>
